home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8847 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: realloc(NULL,100)
  5. Date: 04 Mar 1996 15:56:52 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Mar4085652@qcd.lanl.gov>
  8. References: <31346CB0.41C67EA6@jupiter.di.uminho.pt> <TANMOY.96Feb28151825@qcd.lanl.gov>
  9.     <1996Mar4.122207.16986@friend.kastle.com>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: rich@kastle.com's message of Mon, 4 Mar 1996 12:23:15 GMT
  14.  
  15. In article <1996Mar4.122207.16986@friend.kastle.com>
  16. rich@kastle.com (Richard Krehbiel) writes:
  17.  
  18. <snip>
  19. RK: Something else I wonder; is it valid for realloc(NULL, 100) to fail
  20. RK: (return NULL) in circumstances that malloc(100) would not?  Are the
  21. RK: mechanics of memory allocation so implementation-defined that it's not
  22. RK: possible to say?  Hm.  Probably.
  23.  
  24. It is possible to say, it is just not possible to ask :-)
  25. Contrafactuals (`if I had used malloc instead') cannot be tested by a
  26. strictly conforming C program.
  27.  
  28. RK: Sheesh.  Now I'm fumed.  By the standard's grace, none of my programs
  29. RK: that use malloc may be expected to do a damned thing.
  30.  
  31. More importantly, there is a `translation limits' section which allows
  32. the compiler to reject all but one specific program :-)
  33.  
  34. In any case, it is clear what the standard `intends'. It says very
  35. clearly that realloc with the first parameter NULL is the same as
  36. malloc.
  37.  
  38. Cheers
  39. Tanmoy
  40. --
  41. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  42. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  43. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  44. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  45. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  46. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  47.